|
|
|
|
|
|
|
The ServiceStatus Class will include the following methods and properties: |
|
|
|
|
|
|
|
|
Name. A read-only property that is used to get the service name. |
|
|
|
|
|
|
|
|
DisplayName. A read-only property that is used to get the service display name. |
|
|
|
|
|
|
|
|
CurrentState. A read-only property that is used to get the current running state of the service. |
|
|
|
|
|
|
|
|
There will also be two Friend functions used internally to initialize the class. |
|
|
|
|
|
|
|
|
Think back for a moment at the original requirements for this project: |
|
|
|
|
|
|
|
|
Obtain a list of services. |
|
|
|
|
|
|
|
|
Obtain the current running state of a service. |
|
|
|
|
|
|
|
|
Clearly the three classes here provide the desired functionality. Two things remain. Now that we have the object infrastructure for performing the operations, we need a high-level design for exactly how the utility program will work. Next, we need to figure out the Visual Basic declarations and code needed to actually implement these classes. |
|
|
|
|
|
|
|
|
The design of this class follows the philosophy I used when designing Desaware's API class library (which is part of SpyWorks)that the methods should correspond as closely as possible to the underlying API functions. The advantage of this approach is that it allows you to use the same knowledge for both. The last thing anyone needs is yet another unfamiliar set of commands. |
|
|
|
|
|
|
|
|
One of the first things you might notice when looking at the service API functions is that they make extensive use of constants. There are two ways to deal with constants: One is to create a .BAS module that contains public constants; the other is to use the Enum operator to expose the constants as part of |
|
|
|
|
|